package com.wl.filter;

import javax.servlet.*;
import java.io.IOException;

public class AppFilter implements Filter {

    FilterConfig filterConfig;
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        System.out.println("filter init....");
        this.filterConfig = filterConfig;
    }

    @Override
    public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException {
        System.out.println("filter dofilter....");

        System.out.println(filterConfig.getInitParameter("encoding"));

        chain.doFilter(req,resp);
    }

    @Override
    public void destroy() {
        System.out.println("filter destroy...");
    }
}
